package com.neuedu.ylbx.controller;

import com.neuedu.ylbx.service.InpatientDrugsService;
import com.neuedu.ylbx.utils.ResultVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @version V1.0
 * @author: xianzhen
 * @date: 2025/7/9
 */

@RestController
@RequestMapping("/inpatientDrugs")
@Tag(name = "住院药品控制器")
@CrossOrigin
public class InpatientDrugsController {
    @Autowired
    InpatientDrugsService inpatientDrugsService;

    @GetMapping("/getInpatientDrugs")
    @Operation(summary = "获取药品列表")
    public ResultVo getInpatientDrugs() throws Exception{
        return inpatientDrugsService.list();
    }
    @PostMapping("/addInpatientDrugs")
    @Operation(summary = "添加药品医嘱")
    public ResultVo addInpatientDrugs(String patientId, String drugId, String drugNum, String drugTime, String doctorOrder) throws Exception{
        return inpatientDrugsService.add(patientId, drugId, drugNum, drugTime, doctorOrder);
    }
    @PostMapping("/queryInpatientDrugs")
    @Operation(summary = "查询药品医嘱")
    public ResultVo queryInpatientDrugs(String patientId, String drugId) throws Exception{
        return inpatientDrugsService.query(patientId, drugId);
    }
}
